package com.woniuxy.educationplatform.service.impl;

import com.woniuxy.educationplatform.bean.AdminBean;
import com.woniuxy.educationplatform.bean.GoodsBean;
import com.woniuxy.educationplatform.mapper.GoodsMapper;
import com.woniuxy.educationplatform.mapper.SystemMapper;
import com.woniuxy.educationplatform.service.ISystemService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author unreleased
 * @date 2020/12/8 19:06
 */
@Service
@Transactional(readOnly = true)
public class SystemServiceImpl implements ISystemService {
    @Resource
    private SystemMapper systemMapper;

    @Resource
    private GoodsMapper goodsMapper;
    @Override
    public AdminBean login(String loginName) {
        return systemMapper.findAdminByLoginName(loginName);
    }

    /**
     * 系统首页展示销量top5
     *
     * @return 5条数据的list
     */
    @Override
    public List<GoodsBean> findGoodsSoldTop5() {
        return goodsMapper.findGoodsSoldTop5();
    }

    /**
     * 系统首页展示访问量top5
     *
     * @return 5跳数据的list
     */
    @Override
    public List<GoodsBean> findGoodsVisitedTop5() {
        return goodsMapper.findGoodsVisitedTop5();
    }
}
